import requests
from retrying import retry
"""
超时现象
"""

@retry(stop_max_attempt_number=3, wait_fixed=1000)
def make_request():
    params = {
        "username": "tony",
        "password": "123456"
    }

    rs = requests.request(url="http://127.0.0.1:8080/login", method="post", params=params, timeout=3)
    print(rs.text)
    return rs.text


try:
    rs = make_request()
    print("正常返回:", rs)
except Exception as e:
    print("超时了:", e)
